|
Author
|
Topic: Shader Lighting Experiment
|
obsidian Meridanox Duodecim
Posts: 1419 Registered: Feb 2002 |
posted 02-11-2004 05:24 PM 
This is an experiment that I've been trying out with Q3Map2 and shaders as part of the Q3Map2 Shader Manual: Appendix I - Light Emitting Shaders section. In this appendix section, I wanted to deal with the differences between pre-Q3Map2 light emitting sky shaders and the improvements made in reduced compile time and increased lightmap quality made possible through Q3Map2 introduced shader keywords.I wanted to test the resulting differences that certain Q3Map2 specific shader keywords had on a map illuminated by a single source of light eminating from the sun shader. The goal was to test several different changes, one at a time, in comparison to a map compiled with a sky shader emulating pre-Q3Map2 lighting. By comparing screenshots, we can determine where quality improves and perhaps where there may be limitations. To keep things constant, the same map was compiled with very basic LIGHT switches, -fast is the only switch used (probably shouldn't have used -fast at all but got tired of waiting). The screenshots were all taken from the exact same direction and angle for easy comparisons. All other parts of the shader were kept the same except for certain q3map_* keywords being tested. The screenshots were all taken with "/cg_drawgun 0", "/cg_draw2d 0" and "/r_lightmap 1". The _lightmapscale was lowered in the worldspawn to 0.125. The sky textures were taken from ydnar's "shaderlab_terrain" sample map. The shader was modified from the same map. This is the base shader used for testing. Note the section where I placed the variables being tested: code:
textures/shadermanual/sky { skyparms textures/shaderlab_terrain/env/sky 1024 - q3map_lightImage textures/shaderlab_terrain/sky_clouds.tga //*** VARIABLES START *** ... //*** VARIABLES END *** surfaceparm sky surfaceparm noimpact surfaceparm nolightmap surfaceparm nodlight nopicmip nomipmaps qer_editorimage textures/shaderlab_terrain/sky_clouds.tga { map textures/shaderlab_terrain/sky_clouds.tga tcMod scale 3 3 //tcMod scroll 0.005 -0.0125 rgbGen identityLighting } { map textures/shaderlab_terrain/sky_arc_masked.tga blendFunc GL_ONE_MINUS_SRC_ALPHA GL_SRC_ALPHA tcMod transform 0.25 0 0 0.25 0.1075 0.1075 rgbGen identityLighting } }
The first screenshot emulates a pre-Q3Map2 shader using... q3map_sun 1 1 1 140 -35 25 q3map_lightSubdivide 256 q3map_surfaceLight 200 ... This is the kind of results that you would get using default Quake III Arena shaders. Following that, are the screenshots taken as I made various changes, one at a time, to the above options. The changes made are listed in the top left corner of the screenshots and you can see the resulting differences. #01
#02
#03
#04
#05
#06
#07
#08
#09
One thing that I didn't record was the quantitative differences in LIGHT compile time between different changes in the shader. I had too many different applications running simultaneously for any accurate measurements anyway. Qualitatively however, I did notice a large reduction in compile time by replacing q3map_lightSubDivide (and q3map_surfacelight) with q3map_skylight (approximately from 80 sec. to about 10 sec.). Other keywords like q3map_lightmapFilterRadius obviously increased compile times somewhat. What I'd like to see are some other compiles and experiments using this same map. I think it would be interesting to see what kind of results different people can come up with. Some additional things to try may include using different compile switches and different shader keywords. I'd like to see this as an open discussion on how lighting quality can be improved. The map file is available here (smapi.zip - Shader Manual APpendix I): http://members.lycos.co.uk/quakeroats/samples/ ------------------ Q3Map2 Shader Manual [This message has been edited by obsidian : 02-12-2004.]
|
ydnar Poor anger management
Posts: 2181 Registered: Dec 2000 |
posted 02-11-2004 06:05 PM
Nice!One thing to keep in mind is that q3map_lightmapFilterRadius must be *before* any light-related directives that you want it to affect. You could, for instance have two seperate entries, one before the sun to blur it 8 units, and one before the skyLight, to blur it 64 units. y
|
obsidian Meridanox Duodecim
Posts: 1419 Registered: Feb 2002 |
posted 02-11-2004 06:32 PM 
Hmmm... interesting. I stuck q3map_lightmapFilterRadius after most of the other light directives. I can't seem to find much info on q3map_lightmapFilterRadius (I haven't included it in the Shader Manual yet). In all the examples that I've seen given, the parameters were set at either 0 0 or something like 0 64.What's the first parameter for? I tried setting it to different values but only a value of 1 caused a noticable difference. I'm guessing that the second parameter is the radius at which filtering occurs, but where is the radius measured from? Edit: BTW ydnar, may I see your Cornell Box sample map. I'd like to compare it with this and see what I can do with the lighting. [This message has been edited by obsidian : 02-11-2004.]
|
Eraser Cool #9
Posts: 23419 Registered: Dec 2000 |
posted 02-11-2004 06:42 PM .download)
Those last couple of shots give a really nice soft shadow effect p r o g r a m[This message has been edited by Eraser : 02-11-2004.]
|
ydnar Poor anger management
Posts: 2181 Registered: Dec 2000 |
posted 02-11-2004 06:58 PM
q3map_lightmapFilterRadius :self: :other:Where :self: and :other: are world units of filtering (blurring) of lightmap data cast by any lightsources defined following. The first value is always zero on sky shaders (they don't have lightmaps). The second value is usually high enough to eliminate the "statium shadow" effect of q3map_skyLight. If you use values higher than 4 on the 2nd value of q3map_skyLight (iterations) then you don't need to use q3map_lightmapFilterRadius as much. It's more of a quick hack to approximate finer subdivided sky lighting. y [This message has been edited by ydnar : 02-11-2004.]
|
Boot Louie The Afflicted
Posts: 836 Registered: Apr 2003 |
posted 02-11-2004 07:25 PM
Very nice progression of improving shadow effects. The last couple are really hard to tell apart but I'm pretty sure that ingame results would be more noticeable.This one has shadows coming from multiple light sources and seems to be undesireable unless your level is set on a planet with multiple suns.
|
Kat "...mostly harmless?!"
Posts: 3219 Registered: Nov 2000 |
posted 02-11-2004 08:28 PM .download)
slightly OT : I don't know about anyone else but this *really* highlights the blood, sweat & tears ydnar has put into q3map2, so big thumbs up to ydnar and Co. ------------------ my business my pleasure my profession RtCW SP map they call me Mr Kat
|
Boot Louie The Afflicted
Posts: 836 Registered: Apr 2003 |
posted 02-11-2004 08:39 PM
quote:
Originally posted by Kat: slightly OT : I don't know about anyone else but this *really* highlights the blood, sweat & tears ydnar has put into q3map2, so big thumbs up to ydnar and Co.
|
Here here!!!
|
glossy leet hacksaw
Posts: 3758 Registered: Apr 2002 |
posted 02-11-2004 09:26 PM .download)
quote:
Originally posted by Boot Louie: Here here!!! |
Hear hear !! ------------------
 chillidonut // chilliforum eskimokiss // devteam
|
blahDL Commander
Posts: 106 Registered: Mar 2003 |
posted 02-12-2004 05:52 AM .download)
Are there any recommendations as to what settings would produce the most economical results for the standard mapper? (the best balance of quality and compile time)
|
obsidian Meridanox Duodecim
Posts: 1419 Registered: Feb 2002 |
posted 02-12-2004 07:50 AM 
Added a new screenshot to the list above. The only difference is that I tried moving q3map_lightmapFilterRadius above the other light-related directives. As you can see, the effect is quite different.[This message has been edited by obsidian : 02-12-2004.]
|
ydnar Poor anger management
Posts: 2181 Registered: Dec 2000 |
posted 02-12-2004 09:08 AM
Thanks...  Fast, good quality (brightness values are tweakable): q3map_sunExt 1 1 1 140 -35 25 2 8 q3map_lightmapFilterRadius 0 32 q3map_skyLight 80 3 High quality (final compile): q3map_sunExt 1 1 1 140 -35 25 2 32 q3map_skyLight 80 6 Note the replacement of q3map_lightmapFilterRadius with more skyLight iterations, and more sun samples.
y
|
Techx ~o.O~
Posts: 913 Registered: Jun 2000 |
posted 02-12-2004 09:20 AM
quote:
Originally posted by Kat: slightly OT : I don't know about anyone else but this *really* highlights the blood, sweat & tears ydnar has put into q3map2, so big thumbs up to ydnar and Co.
|
I concur! The differences in shadow quality are really substantial when you do a comparison like this, now if I can only implement it in a map!@ 
|
obsidian Meridanox Duodecim
Posts: 1419 Registered: Feb 2002 |
posted 02-12-2004 03:17 PM 
quote:
Originally posted by ydnar:
Fast, good quality (brightness values are tweakable): q3map_sunExt 1 1 1 140 -35 25 2 8 q3map_lightmapFilterRadius 0 32 q3map_skyLight 80 3High quality (final compile): q3map_sunExt 1 1 1 140 -35 25 2 32 q3map_skyLight 80 6
|
These two screenshots are based on your set of parameters. #10
#11
Same as the second one, except with q3map_lightmapFilterRadius 0 8
#12 I'm curious on people's opinions about these, which screenshot do you think looks the best? [This message has been edited by obsidian : 02-12-2004.]
|
cis Veteran
Posts: 194 Registered: Nov 2003 |
posted 02-12-2004 03:27 PM
hard question, i would say the second one(#11) has the nicer shadow on the floor (a tad more contrast) while the third(#12) has a nicer shadow on the larger brush (thrown by the smaller brush, blurred looks more right there). third one seems smoother over all but visibly trades of contrast for that smoothnessedit: the more i switch between 2nd and 3rd the more i like the 3rd actualy [This message has been edited by cis : 02-12-2004.]
|
ydnar Poor anger management
Posts: 2181 Registered: Dec 2000 |
posted 02-12-2004 05:57 PM
q3map_lightmapFilterRadius should usually be *after* q3map_sunExt so it doesn't blur the sun shadows, which are already jittered. Try that.  y
|
obsidian Meridanox Duodecim
Posts: 1419 Registered: Feb 2002 |
posted 02-12-2004 07:02 PM 
q3map_sunExt 1 1 1 140 -35 25 3 32 q3map_lightmapFilterRadius 0 8 q3map_skyLight 100 6 #13
|
cis Veteran
Posts: 194 Registered: Nov 2003 |
posted 02-13-2004 07:10 AM
#13 rocks/me saves a local copy of this thread :)
|
Boot Louie The Afflicted
Posts: 836 Registered: Apr 2003 |
posted 02-13-2004 02:57 PM
#13... Now thats sweet!!  This page is saved down to here. Well worth the drive space. [This message has been edited by Boot Louie : 02-13-2004.]
|